<% layout('/layouts/default.html', {title: '结算申请管理', libs: ['validate','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="inputForm" model="${settlementApply}" action="${ctx}/settlementapply/settlementApply/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('渠道')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.channel}</span>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('申请方')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.whatsoever}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('姓名')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.name}</span>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('联系方式')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.contact}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('结算概览')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.settlementOverview}</span>	
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('结算金额')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.settlementAmount}元</span>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('场馆地址')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.address}</span>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								${text('申请状态')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<span>${settlementApply.settlementApplyState == 1 ? '结算中':'已结算'}</span>							
							</div>
						</div>
					</div>
				</div>
			</div>
		</#form:form>
		
			<div class="form-unit">${text('订单信息')}</div>
			<div style="width:98%;margin-left:1%">
			    <table id="dataGrid"></table>
			    <div id="dataGridPage"></div>
			</div>
			
	        <#form:form id="searchForm" model="" action="" method="post" class="form-inline"
	            data-page-no="${parameter.pageNo}" data-page-size="10" data-order-by="${parameter.orderBy}">
	        </#form:form>
        
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>        
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});

$(document).ready(function () {	
	var settlementApplyId = '${settlementApply.id}';
	var url = '${ctx}/settlementapply/settlementApply/settlementApplyItemListData?settlementApplyId=' + settlementApplyId;
	$("#searchForm").attr("action", url);
	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
	          {header:'${text("订单号")}', name:'orderNum', index:'a.order_num', width:150, align:"center"},
	          {header:'${text("订单金额")}', name:'orderMoney', index:'a.order_money', width:150, align:"center", formatter: function(val, obj, row, act){
	  			return val + "元"; 
	  		  }},
	          {header:'${text("结算类型")}', name:'settlementType', index:'a.settlement_type', width:150, align:"center"},
	          {header:'${text("结算金额")}', name:'settlementMoney', index:'a.settlement_money', width:150, align:"center", formatter: function(val, obj, row, act){
	  			return val + "元"; 
  			  }},
		],
	}); 
})
</script>